<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
        <meta name="format-detection" content="telephone=no"/>
        <title>凤凰新闻</title>
        
        <link rel="stylesheet" type="text/css" href="doc.css">
            <script type="text/javascript" src='jquery1.11.js'></script>
            <script type="text/javascript" src="doc.js"></script>
    </head>
    
    <body>
        <!--{order}-->
        
        <!--{headImg}-->
        
        <div id="article" class="article">
            <!--{title}-->
            
            <!--{time_source}-->
            
            <!--{info}-->
            <!--{weidian}-->
         
            <div class="%@" id="content">
                <!--{audio}-->
                
                <!--{video}-->
                
                <!--{slides}-->
                
                <div id="docContent">
                    <!--{text}-->
                </div>
                
            </div>
            <!--{tip}-->
            
            <!--{editorCode}-->
            
            <div class="textBottom"></div>
        </div>
        
        <!--{disclaimer}-->
        <!--{originalLink}-->
        
        
        <div style="height:0px;width=100%" id="lastObj" ></div>
    </body>
    
    
</html>
<script type="text/javascript">
    
    //获取元素的纵坐标
    function getTop(e){
        var offset=e.offsetTop;
        if(e.offsetParent!=null) offset+=getTop(e.offsetParent);
        return offset;
    }
//获取元素的横坐标
function getLeft(e){
    var offset=e.offsetLeft;
    if(e.offsetParent!=null) offset+=getLeft(e.offsetParent);
    return offset;
}

function videoClick(obj,index){
    
    var div=obj.parentNode;
    if(div){
        var top=getTop(div);
        var left=getLeft(div);
        var width=div.offsetWidth;
        var height=div.offsetHeight;
        if(grounds){
            grounds.playVideo(index,top,left,width,height);
        }
        
        
    }
}

function changeFont(flag){
    var divcontent="content ";
    var noteclass="img-note ";
    
    
    switch(flag){
        case 2:
        divcontent+="content_middle";
        noteclass+="note_font_middle";
        break;
        
        case 1:
        divcontent+="content_small";
        noteclass+="note_font_small";
        break;
        case 3:
        divcontent+="content_big";
        noteclass+="note_font_big";
        break;
        case 4:
        divcontent+="content_biggest";
        noteclass+="note_font_biggest";
        break;
        case 6:
        divcontent+="content_huge";
        noteclass+="note_font_huge";
        break;

        
    }
    
    var content=document.getElementById("content");
    content.className=divcontent;
    var smalls=document.getElementsByTagName("small");
    for(var i=0;i<smalls.length;i++){
        smalls[i].className=noteclass;
    }
    var spans=document.getElementsByTagName("span");
    for(var i=0;i<spans.length;i++){
        spans[i].className=spans[i].className;
    }
    
    
}

function goSlides(slide){
    if(grounds){
        grounds.goSlider(slide.getAttribute('data-original'));
    }
}


function goOrigin(){
    if(grounds){
        grounds.goOrigin("");
    }
}


function showPic(div){
    

    if(div){
        var imgtag=div.getElementsByTagName("img")[0];
        var src=imgtag.getAttribute('src');
        if(imgtag &&( src==null || src=="")){
            var url=div.getAttribute('data-original');
            imgtag.setAttribute('src',url);
        }else{
            var top=getTop(div);
            var left=getLeft(div);
            var width=div.offsetWidth;
            var height=div.offsetHeight;
            
            
            if(grounds){
                grounds.showPic(div.getAttribute('data-original'),top,left,width,height);
            }

        }
    }

}



function formatImg(fragment){
    
    var imgs=Array.prototype.slice.call(fragment.getElementsByTagName('img'));
    for ( var i = 0; i < imgs.length; i++){
        var img = imgs[i];
        var parent = img.parentNode;
        if(parent.childNodes.length>1){
            var p=document.createElement('p');
            parent.replaceChild(p,img);
            p.appendChild(img);
            p.className='img_p';
        }else{
            parent.className='img_p';
        }
        
        
    }
    
}

function audioFrame(){
    var obj=document.getElementById("audio");
    if(obj){
        var top=getTop(obj);
        var left=getLeft(obj);
        var width=obj.offsetWidth;
        var height=obj.offsetHeight;
        return ""+left+","+top+","+width+","+height;
    }else{
        return "";
    }
}

function divFrameByName(objid){
    var obj=document.getElementById(objid);
    if(obj){
        var top=getTop(obj);
        var left=getLeft(obj);
        var width=obj.offsetWidth;
        var height=obj.offsetHeight;
        return ""+left+","+top+","+width+","+height;
    }else{
        return "";
    }
}

function dispatchLink(obj){
    
    var href=obj.getAttribute('href');
    var type=obj.getAttribute('type');
    if(grounds){
        grounds.dispatchLink(type+"",href+"");
    }
    
    
    return false;
}



function addLoadLazy(offset){
    $(".lazy2").lazyload({ threshold :1000});
    $(".lazy").lazyload({ threshold :offset,effect : "fadeIn",effectspeed:300});
}


function lastObjFrame(){
    var obj=document.getElementById("lastObj");
    if(obj){
        var top=getTop(obj);
        var left=getLeft(obj);
        var width=obj.offsetWidth;
        var height=obj.offsetHeight;
        return ""+left+","+top+","+width+","+height;
    }else{
        return "";
    }
    
    
}

function showUpcomment(count){
  
    if(count>0){
        var obj=document.getElementById("whata");
    
        obj.style.display="inline";
        var obj1=document.getElementById("upcomment");
   
        obj1.innerHTML=""+count;
    }
}

function gotoComment(){
  
    try{
    grounds.gotoComment();
    }catch(e){
        
    }
}

function trimStr(str){return str.replace(/(^\s*)|(\s*$)/g,"");}


function formatText(fragment){
    
    try{
        
        var b=fragment.getElementsByTagName('p');
        
        var lasterp=null;
        var eles = Array.prototype.slice.call(fragment.getElementsByTagName('p'));
        for ( var i = 0; i < eles.length; i++){
            var container = eles[i];
            try{
                
                if(trimStr($(container).text())=="" && container.getElementsByTagName('img').length === 0){
                    
                    container.style.display="none";
                    
                    continue;
                }
            
            
            }catch(e){
               
            }
            /*
            if(container.getElementsByTagName('small').length === 1) {
                container.className += ' %@';
                
            }*/
            if($(container).text()){
                lasterp=container;
            }
            
            
        }
        if(lasterp)
        lasterp.innerHTML=lasterp.innerHTML+"<img height=\"%fpx\" width=\"%fpx\"  src=\"%@\"/>";
   
        return fragment.innerHTML;
    }catch(e){
        
        
    }
    
}
var div=document.getElementById("docContent");

formatImg(div);
formatText(div);
/*
$(document).ready(function (){
                  $(".lazy2").lazyload({ threshold :1000});
                  
                  });
 */


    </script>